package ru.vf.utils;

import java.util.Date;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface.OnClickListener;
import android.graphics.Rect;

public class Utils {
	public static long Hours() {
		return (new Date()).getTime() / 3600000;
	}
	
	public static AlertDialog question(Activity activity, int a_title, int message, 
			int yes, int no, OnClickListener ClickListener) {
		AlertDialog.Builder adb = new AlertDialog.Builder(activity);
		adb.setTitle(a_title);
		adb.setMessage(message);
		adb.setIcon(android.R.drawable.ic_dialog_info);
		adb.setPositiveButton(yes, ClickListener);
		adb.setNegativeButton(no, ClickListener);
		//adb.setNeutralButton(R.string.cancel, myClickListener);
		return adb.create();		
	}
	
	public static Rect rectResize(Rect a_rect, int left, int top, int right, int bottom) {
		a_rect.left += left;
		a_rect.top += top;
		a_rect.right += right;
		a_rect.bottom += bottom;
		return a_rect;
	}
	
	public static float limit(float value, float min, float max) {
		return Math.max(min, Math.min(max, value));
	}
}
